home *** CD-ROM | disk | FTP | other *** search
- #ifndef __CLASSICIMAGE__
- #define __CLASSICIMAGE__
- /******************************************************************************\
- *
- * Apple Macintosh Developer Technical Support
- *
- * Main header file for the ClassicImage application
- *
- * Program: WorldImage
- * File: WorldImage.h
- *
- * by: Forrest Tanaka
- *
- * Copyright © 1988-1991 Apple Computer, Inc.
- * All rights reserved.
- *
- \******************************************************************************/
-
-
- /******************************************************************************\
- * Header Files
- \******************************************************************************/
-
- #ifndef __STANDARDFILE__
- #include <StandardFile.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
-
- /******************************************************************************\
- * Constants
- \******************************************************************************/
-
- #define kScrollBarWidth 16 /* Number of pixels wide a scroll bar is */
-
- /* Alert types */
- #define kGenericAlert 0 /* Display a generic alert */
- #define kNoteAlert 1 /* Display the note alert */
- #define kCautionAlert 2 /* Display the caution alert */
- #define kStopAlert 3 /* Display the stop alert */
-
- /* Alert button options */
- #define rOKAlertID 6010 /* Resource ID of OK alert */
- #define rOKCancelAlertID 6011 /* Resource ID of OK/Cancel alert */
- #define rSaveAlertID 6012 /* Resource ID of Save/Cancel/Don’t Save alert */
-
- /* Button item numbers */
- #define kSaveButton 1 /* Item number of Save button */
- #define kCancelSaveButton 2 /* Item number of Cancel button for saves */
- #define kDontSaveButton 3 /* Item number of Don’t Save button */
-
- /* Memory error message constants */
- #define rMemErrMessages 1000 /* Resource ID of memory error msg STR# */
- #define kMemErrAppOpenMsg 1 /* Not enough memory to open application */
- #define kMemErrOpenDocMsg 2 /* Not enough memory to open a document */
-
- /* Resource error message constants */
- #define rResErrMessages 1001 /* Resource ID of resource err message STR# */
- #define kResErrAppDamageMsg 1 /* Application is damaged */
-
- /* Miscellaneous error message constants */
- #define rMiscErrMessages 1002 /* Resource ID of misc. error message STR# */
- #define kMiscErrUnknownMsg 1 /* Unknown error */
- #define kMiscErrNoQTMsg 2 /* QuickTime not available */
- #define kMiscQuickTimeMsg 3 /* Some sort of QuickTime error */
-
- /* File error message constants */
- #define rFileErrMessages 1003 /* Resource ID of file error message STR# */
- #define kFileErrDocOpenMsg 1 /* Document is already open elsewhere */
-
-
- /******************************************************************************\
- * Macros
- \******************************************************************************/
-
- #ifdef applec
- #define topLeft(r) (*((Point *) &(r).top))
- #define botRight(r) (*((Point *) &(r).bottom))
- #endif
-
- #define hiWord(a) ((short) (((unsigned long) a) >> 16L))
- #define loWord(a) ((short) ((unsigned long) a))
-
-
- /******************************************************************************\
- * Global Variables
- \******************************************************************************/
-
- extern Boolean gQuitting; /* True if user requested that app quit */
- extern Boolean gWereInFront; /* True if this application is frontmost */
- extern Boolean gFixMenus; /* True if menus need fixing */
- extern Boolean gHasAppleEvents; /* True if Apple Events implemented */
- extern Boolean gHasCoolSF; /* True if 7.0 Standard File available */
- extern ControlActionUPP gActionProc;
- extern QDBitsUPP gQDBitsUPP;
- extern QDGetPicUPP gQDGetPicUPP;
- extern QDPutPicUPP gQDPutPicUPP;
-
-
- /******************************************************************************\
- * DoQuit - Handle Quit request from the user
- *
- * When the user requests that this application should quit, DoQuit is called to
- * perform the Quit command. All open document windows and desk accessory
- * windows (only applicable before system software version 7.0) are closed and
- * the gQuitting global variable is set to true.
- \******************************************************************************/
-
- void DoQuit(void);
-
-
- /******************************************************************************\
- * IsDAWindow - Test to see whether a window belongs to a DA or not
- *
- * If the window specified by aWindow belongs to a desk accessory, then
- * IsDAWindow returns true, otherwise it returns false. If aWindow is nil, then
- * IsDAWindow returns false.
- \******************************************************************************/
-
- Boolean IsDAWindow(
- WindowPtr aWindow);
-
-
- /******************************************************************************\
- * DoUpdateEvt - Handle an update event for any window
- *
- * When an update event is received, DoUpdateEvt is called to handle the
- * redrawing of the window that caused the update event. DoUpdateEvt determines
- * the kind of window that needs updating and calls the routine that handles that
- * kind of window to draw it. The anEvent parameter contains the update event.
- \******************************************************************************/
-
- void DoUpdateEvt(
- EventRecord *anEvent);
-
-
- /******************************************************************************\
- * DoActivateEvt - Handle an activate event for any window
- *
- * DoActivateEvt is called when an active event is received for the window
- * specified by eventWind. becomingActive is TRUE if the window is becoming
- * activated. It’s FALSE if the window is becoming inactive.
- \******************************************************************************/
-
- void DoActivateEvt(
- WindowPtr eventWindow,
- Boolean becomingActive);
-
-
- /******************************************************************************\
- * ShowAlert - Show an alert
- *
- * This routine puts up a an alert with a specified message. alertType specifies
- * which kind of icon to display in the upper-left corner of the alert.
- * kGenericAlert specifies that no icon should be displayed. kNoteAlert
- * specifies that the note icon should be displayed. kCautionAlert specifies
- * that the caution icon should be displayed. kStopAlert specifies that the stop
- * icon should be displayed.
- *
- * buttonOption specifies what buttons should be offered. rOKAlertID specifies
- * that only an OK button should be offered. rOKCancelAlertID specifies that
- * both an OK and a Cancel button should be offered.
- *
- * messageClass specifies the STR# resource ID which contains the message to
- * display and messageIndex specifies the index (the first message is index 1)
- * into that STR# of the message to display.
- *
- * The alert window is placed into alert position on the screen containing most
- * of the window specified by parentWindow, or the main screen if parentWindow is
- * nil.
- \******************************************************************************/
-
- short ShowAlert(
- short alertType,
- short buttonOption,
- short messageClass,
- short messageIndex);
-
-
- /******************************************************************************\
- * TrapExists - Determine whether a trap is implemented
- *
- * If the trap specified by theTrap is implemented, then TrapExists returns true.
- * Otherwise, false is returned.
- \******************************************************************************/
-
- Boolean TrapExists(
- short theTrap);
-
-
- /******************************************************************************\
- * FileSpecGet
- *
- *
- \******************************************************************************/
-
- Boolean FileSpecGet(
- FileFilterProcPtr fileFilter,
- short numTypes,
- SFTypeList typeList,
- StandardFileReply *retReply);
-
-
- /******************************************************************************\
- * ConvertOldToNewSFReply - Convert old SFReply record to new StandardFileReply record
- *
- * The old SFReply record passed in oldReply is converted to the new
- * StandardFileReply record that was introduced with system software version 7.0.
- * The resulting StandardFileReply record is returned in the newReply parameter.
- * If any errors occur, the error code is returned and newReply is untouched.
- *
- * The following conversions are done:
- *
- * StandardFileReply SFReply
- * ----------------- -------
- * Boolean sfGood <- Boolean good
- * Boolean sfReplacing <- true if file exists, false if not
- * OSType sfType <- OSType fType
- * FSSpec sfFile
- * vRefNum; <- real vRefnum from (short vRefNum)
- * parID; <- real dirID from (short vRefNum)
- * name; <- Str63 fName
- * ScriptCode sfScript <- iuSystemScript
- * short sfFlags <- 0
- * Boolean sfIsFolder <- false
- * Boolean sfIsVolume <- false
- * long sfReserved1 <- 0
- * short sfReserved2 <- 0
- *
- * The setting of sfScript to iuSystemScript I believe is incorrect, but I also
- * believe that it’s the best that can be done. There’s no reliable way to tell
- * which script a user was using when he or she typed in the file name in the
- * Standard File dialog. So, GUESS!
- \******************************************************************************/
-
- OSErr ConvertOldToNewSFReply(
- SFReply *oldReply,
- StandardFileReply *newReply);
-
-
- /******************************************************************************\
- * EqualFSSpec - Check equality of FSSpec records
- *
- * EqualFSSpec returns TRUE if the file specified by spec1 refers to the same
- * file as the one specified by spec2. Otherwise, EqualFSSpec returns FALSE.
- \******************************************************************************/
-
- Boolean EqualFSSpec(
- FSSpecPtr spec0,
- FSSpecPtr spec1);
-
-
- /******************************************************************************\
- * CmdPeriodEvent - Detect whether an event is a command-period
- *
- * This routine determines whether the event passed in anEvent was caused by the
- * user typing command-period. If it was, then true is returned, otherwise false
- * is returned.
- \******************************************************************************/
-
- Boolean CmdPeriodEvent(
- EventRecord *anEvent);
-
-
- /******************************************************************************\
- * FakeButtonHit - Visually simulate the click of a button
- *
- * This routine is used to hilight a button for one-tenth of a second to visually
- * simulate the click of the mouse on the button passed in the buttonControl
- * parameter. This is normally used when the Enter or Return key is pressed when
- * a dialog box is up. The default button must be momentarily hilighted to show
- * the user what he or she actually did.
- \******************************************************************************/
-
- void FakeButtonHit(
- ControlHandle buttonControl);
-
-
- /******************************************************************************\
- * Public: CreateGrafPort
- *
- * Most of this code is very similar to the code in Macintosh Technical Note #41
- * “Drawing Into an Off-Screen BitMap.
- \******************************************************************************/
-
- GrafPtr CreateGrafPort(
- Rect *bounds);
-
-
- /******************************************************************************\
- * DisposeGrafPort
- *
- * DisposeGrafPort disposes of the GrafPort specified by doomedPort. The visRgn,
- * clipRgn, bit image, and the GrafPort structure itself must all be disposed of.
- * ClosePort is called to dispose of the visRgn and clipRgn. The bit image and
- * GrafPort itself are normal non-relocatable blocks of memory, so they’re just
- * disposed of through DisposePtr.
- \******************************************************************************/
-
- void DisposeGrafPort(
- GrafPtr doomedPort);
-
-
- /******************************************************************************\
- * NAME & SYNOPSIS:
- * RestoreColorsPalette: Restore all screens to the default color table
- *
- * PARAMETERS:
- * None
- *
- * DEFINITION:
- * RestoreColorsPalette sets the color tables of all screens to the default
- * colors by using the Palette Manager. Direct-color screens and screens which
- * already have the default set of colors are unaffected. It’s assumed that
- * Color QuickDraw is available, and 32-Bit QuickDraw 1.0 and/or system software
- * version 6.0.5 and beyond is available.
- *
- * RETURN VALUES:
- * None
- \******************************************************************************/
-
- void RestoreColorsPalette(void);
-
-
- /******************************************************************************\
- * NAME & SYNOPSIS:
- * RestoreColorsSlam: Restore all screens to the default color table
- *
- * PARAMETERS:
- * None
- *
- * DEFINITION:
- * RestoreColorsSlam sets the color tables of all screens to the default colors
- * by using low-level calls. All screens are redrawn when this routine is
- * called. Also, if the color table has been changed and then RestoreColorsSlam
- * is called to reset them, all screens are still redrawn when the application
- * quits. It’s assumed that Color QuickDraw is available, and 32-Bit QuickDraw
- * 1.0 and/or system software version 6.0.5 and beyond is available.
- *
- * RETURN VALUES:
- * None
- \******************************************************************************/
-
- void RestoreColorsSlam(void);
-
-
- #endif
-